package practice01;

/**
 * @author Administrator
 * @version V1.0
 * @ProjectName:IntelliJ IDEA
 * @PackageName: PACKAGE_NAME
 * @ClassName: practice01.Student
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @date 2019/12/12 19:05
 * @Copyright 大牛版板所有
 */
public class Student {
    private String sNo;
    private String sName;
    private int sAge;
    private String sCollege;

    public Student() {
    }

    public Student(String sNo, String sName, int sAge, String sCollege) {
        this.sNo = sNo;
        this.sName = sName;
        this.sAge = sAge;
        this.sCollege = sCollege;
    }

    public String getsNo() {
        return sNo;
    }

    public void setsNo(String sNo) {
        this.sNo = sNo;
    }

    public String getsName() {
        return sName;
    }

    public void setsName(String sName) {
        this.sName = sName;
    }

    public int getsAge() {
        return sAge;
    }

    public void setsAge(int sAge) {
        this.sAge = sAge;
    }

    public String getsCollege() {
        return sCollege;
    }

    public void setsCollege(String sCollege) {
        this.sCollege = sCollege;
    }

    public void printInfor() throws IllegleSnoException,IllegleSageException{
        if (this.getsNo().length() < 8){
            throw new IllegleSnoException("出现异常，不合法的学号！");
        }
        if (this.getsAge()<0 || this.getsAge()>200){
            throw new IllegleSageException("出现异常，不合法的年龄！");
        }
        System.out.println(this.getsName()+"今年已经"+this.getsAge()+"岁了，目前就读于"+this.getsCollege()
                +"大学，学号为："+this.getsNo());
    }

    public static void main(String[] args) throws IllegleSnoException,IllegleSageException {
        Student stu = new Student("12345678","张三",19,"安徽大学");
        stu.printInfor();
    }
}
